// const mongoose = require('mongoose')
// 引入mongoose
import mongoose from 'mongoose'
// 集合实例化Schema
const Schema = mongoose.Schema

// 创建用户集合规则
const UserSchema = new Schema({
  username: {
    type: String,
    require: true
  },
  password: {
    type: String,
    require: true
  },
  email: {
    type: String,
    unique: true,
    require: true
  }
})
// 创建用户集合
const user = mongoose.model('User', UserSchema)
// 导出用户集合
export default user
